AUTORUN.EXE, Version 1.01, 12/23/1996 ------------------------------------- Copyright © 1996 Glenn M. Picher, Dirigo Multimedia Published by g/matter, inc. Sales: sales@gmatter.com, (800)933-6223 Technical support: support@gmatter.com, (415)243-0394 Web: http://www.gmatter.com Programmer: Glenn M. Picher, Dirigo Multimedia Email: gpicher@maine.com Web: http://www.maine.com/shops/gpicher Phone: (207)767-8015 This Read Me document covers the following topics: - Launching an installer or installed software with AutoRun.EXE - Macintosh equivalents of Windows AutoRun tools - Specifying different behaviors with different Windows versions - Launching documents instead of applications - Using AutoRun.EXE as a simple launcher - Using AutoRun.EXE for post-shipment updates & enhancements - Using command line prefixes and suffixes - Running programs sequentially in low-memory environments - Launching MS-DOS programs with AutoRun.EXE - Controlling AutoRun.EXE's behavior with AUTORUN.INI settings - Creating an AUTORUN.INF file to make AutoRun.EXE start automatically - Testing AutoRun.EXE without cutting CD-ROMs - Limitations of AutoRun behavior - Standard legal disclaimer Launching an installer or installed software with AutoRun.EXE ------------------------------------------------------------- AUTORUN.EXE is a small C-coded utility launcher application that's designed to be quickly loaded automatically by the AutoRun feature of Windows 95 and Windows NT 4.0, to either install a CD-ROM's software, or run the already-installed software from the hard drive. Since AUTORUN.EXE is a 16-bit program, it can also be run by Windows 3.1 users by double-clicking on it in the File Manager (or using Program Manager's File/Run, etc). This lets you streamline the installation process for your end users, lowering your tech support expenses and simplifying your CD-ROM's insert card instructions. AutoRun decides whether the CD's software has been installed by checking for a particular setting in an .INI file in the Windows directory which indicates the installed location. It is your installer's responsibility to establish this file. Most Windows installer packages can do this, though the technique varies. Indigo Rose Software Corporation's Setup Facory can do this nicely with its INI files editor feature. You can also establish this file from a Director projector-based installer. You can use the *free* WinDirs XObject, also from Dirigo Multimedia, to locate the Windows directory, and you can use Director's FileIO Xtra or XObject to write the contents of the .INI file. Macintosh equivalents of Windows AutoRun tools ---------------------------------------------- Macintosh equivalents of these Windows tools are also available from Dirigo Multimedia. AutoStart is a small C-coded application that similarly decides whether to install a CD-ROM's software or run the installed software from the hard drive. It can be made to run automatically with the AutoStart feature built into QuickTime for Macintosh, versions 2.0 and later. The utility program DropStart is a no-brainer Mac application to set the AutoStart application or document. The *free* PrefsFolder Xobject lets you locate the startup disk's Preferences folder, where you can establish the CD-ROM's settings file with Director's FileIO Xtra or XObject. Finally, a plug-in for Aladdin Systems' Stuffit InstallerMaker, "PrefsMaker", can let you record the user's choice of installation folder to the settings file automatically. Specifying different behaviors with different Windows versions -------------------------------------------------------------- AutoRun can determine the current operating system and run different installers or installed software, depending on the OS version. You can specify different installer applications and installed-software applications for use under Window 3.1, Windows 95 and Windows NT. This can be very useful for Macromedia Director developers who want to deliver the optimal projector on the various operating system versions, but who are using XObjects, and thus must specify a 16-bit projector rather than a 32-bit projector for use under Windows NT. Launching documents instead of applications ------------------------------------------- AutoRun.EXE supports launching document files instead of program files. For instance, you could supply an HTML ".HTM" file with your product and specify that as the installation document. AutoRun.EXE will locate whatever Web browser application is already installed on the user's system to handle ".HTM" files, and launch it with the supplied .HTM file. If you use HTML's "meta refresh" tag within that local HTML file, you can redirect the Web browser to an actual site on the Internet. Another use of this feature could be to automatically play a .WAV sound file when your CD-ROM is inserted. See more details below in the description of the prefix and suffix settings of AUTORUN.INI . Using AutoRun.EXE as a simple launcher -------------------------------------- You need not use the full feature set of AutoRun.EXE, if your product does not need a full installation to the user's hard drive. You can use it only as a launcher program. AutoRun.EXE need not be placed at the top level of a disk, need not be set to run automatically when the disk is inserted, and need not be used only on CD-ROMs. You could make AutoRun.EXE your point of entry for your software on the CD-ROM itself, or for your installed applications on the hard drive, for instance (letting AutoRun.EXE choose the appropriate 16-bit or 32-bit application to run, depending on the available Windows version). Using AutoRun.EXE for post-shipment updates & enhancements ---------------------------------------------------------- Because AutoRun.EXE will launch software from the hard drive only if it is installed, you can use AutoRun.EXE as a post-shipment update mechanism. For instance, as shipped, your software might run directly from your CD-ROM. However, by specifying alternative settings in a .INI file in the Windows directory, AutoRun.EXE will instead run a later updated or more full-featured version of your software. This approach lets you fix bugs in your initial release or add new features after shipment without having to master and redistribute an entirely new CD-ROM. Your update would simply access existing media on the initially shipping version of your CD-ROM. Alternatively, your tech support personnel could use this mechanism to investigate problems on a specific user's system, by launching a debugging version of your software rather than the release version on the CD-ROM itself. Using command line prefixes and suffixes ---------------------------------------- AutoRun.EXE includes settings that allow you to specify command line arguments when your installer or installed software is launched. This works both when simply launching a program and when specifying a document for AutoRun.EXE to open with another application. This can be used to control the behavior of launched programs which respond to command line arguments (for example, making Sound Recorder play a sound file and quit when launched, rather than opening the sound file for editing). See more details below in the description of the prefix and suffix settings of AUTORUN.INI . Running programs sequentially in low-memory environments -------------------------------------------------------- AutoRun.EXE could be used simply as a stub application switcher. In other words, on a low-memory machine, you might want to quit your main application and switch to another application such as a Web browser or a document viewer such as Adobe Acrobat Reader. Since there might not be enough memory available for both a browser/viewer and your main application, you could launch AutoRun.EXE and quit immediately from your main application, freeing up its memory for use by the browser/viewer, which AutoRun.EXE will launch for you. AutoRun.EXE's memory requirements are minimal. Depending upon your project's needs, you might find that Relaunch.EXE, also from Dirigo Multimedia, may do a better job as a stub application switcher. Relaunch.EXE can explicitly wait for the main program to quit, launch the new program, wait for it to quit, and automatically relaunch your main program. A Macintosh version of Relaunch is also available. Launching MS-DOS programs with AutoRun.EXE ------------------------------------------ In addition to launching standard Windows .EXE programs as installers or as installed software on the hard drive, AutoRun.EXE can run MS-DOS ".BAT" batch files, MS-DOS ".EXE" & ".COM" programs, and MS-DOS ".PIF" program information files. You might want to do this if you wish to use PKWare's MS-DOS based PKUNZIP.EXE program to expand a ".ZIP" file as part of your installation process. It's usually advisable to supply and launch a ".PIF" file rather than launching an MS-DOS ".BAT", ".EXE" or ".COM" file directly. A .PIF file allows you to specify memory usage and display options for the MS-DOS program. This can avoid the screen flash and sync jitters that can occur when an MS-DOS program switches from standard Windows to full-screen MS-DOS display mode. Under Windows 95, you can specify .PIF file settings by editing a ".PIF" file's properties (using the right mouse button and the various tabs that then appear). Under Windows 3.1, you can use the PIF Editor supplied in the "Main" program group. You should specify a relative path name for the MS-DOS program within the .PIF file, such as ".\setup.bat", rather than a hard-coded path name, because the CD-ROM drive letter or hard drive letter may vary on different users' systems. A relative filename will work because AutoRun.EXE always makes the launched application or document file's folder the current folder before launching. Controlling AutoRun.EXE's behavior with AUTORUN.INI settings ------------------------------------------------------------ AutoRun's behavior is controlled by AUTORUN.INI, located in the same folder as AUTORUN.EXE . Alternatively, if you wish to keep the top level of your CD-ROM as free from distracting files as possible, you can also place AUTORUN.INI within a subfolder named "SETTINGS" in the same folder as AUTORUN.EXE . Here is documentation of the various settings in this .INI file. [AUTORUN.EXE Settings] ;required section name RunLocationFileName=AR-INST ;name of .INI file in Windows directory RunLocationSection=Installed Locations ;section name in .INI file RunLocationKeyword=TestAutoRunCD ;setting name in .INI file These settings are used to specify where AutoRun.EXE will find information about the installed software on the hard drive. For the above settings in AUTORUN.INI, AUTORUN.EXE would check for a file named AR-INST.INI in the Windows directory. Its contents would be expected to include... [Installed Locations] TestAutoRunCD=c:\testdir ;or whatever folder the user chose to install the software If your installer package can more easily create an .INI setting with a trailing backslash at the end of the folder name, AutoRun.EXE will accept that syntax as well. InstallNeeded=1 ;should we run an installer? 0 = no, 1 = yes You do not necessarily need to use an installer / installed software combination to make use of AutoRun.EXE . If you simply wish to start a program or open a document appropriate to the current Windows version, you can specify an application on your CD as an "installer", and specify Run settings that your software never does set up. Alternatively, if you only want AutoRun behavior to take place once the software has been installed "by hand" by the user onto the hard drive, you can specify only the Run program, not the Install program. InstallShowAlert=1 ;show an alert before auto-installing? InstallAllowCancel=1 ;show cancel button on that alert? InstallAlertTitle=Install software from CD? ;alert title bar text ;up to 5 lines of alert box text InstallAlertText1= InstallAlertText2=This is the first time you've used this CD. InstallAlertText3= InstallAlertText4=Install this CD's software now? InstallAlertText5= These settings allow you to present a minimal user interface when the CD-ROM is inserted and the software has never been installed. User interface guidelines specify that it's a good idea to notify the user when a lengthy process is being automatically started, and that it's advisable to allow the user to cancel the process. InstallProgram16=SETUP16\SETUP.EXE ;Win 3.1 install program InstallProgram32=SETUP32\SETUP.EXE ;Win95 install program InstallProgramNT=SETUP32\SETUP.EXE ;WinNT install program These settings let you specify the names of the installation programs or documents that will be started, when needed, on the various Windows versions. The names are relative to the location of AUTORUN.EXE. They do not include an absolute drive letter, because various users may have CD-ROMs installed under different drive letters. If you do not need to specify different installers for the different Windows versions, simply specify the same file name for all three settings. ;next group of settings only relevant if InstallNeeded is 1 ReinstallShowAlert=1 ;show alert if installed software is missing? ;missing software alert title bar text ReinstallAlertTitle=Installed software moved or deleted ;up to 5 lines of instructions when software's missing ReinstallAlertText1=This CD's software has been installed before, but ReinstallAlertText2=apparently the software has been moved or deleted. ReinstallAlertText3= ReinstallAlertText4=Please install the CD's software again by running ReinstallAlertText5=the setup program directly from the CD. These settings allow you to show an informational alert when a CD-ROM's software has been installed on the hard drive, but the software has been deleted, moved to a different location, or the drive letter of the hard drive has changed for some reason (perhaps because new hardware has been added to or removed from the system). It is possible to add awareness of this potential pitfall to your installed software. Each time it is run, it could check the installed location .INI file settings and update them if necessary. In such case, you could simply instruct your users to locate and run the actual installed software on the hard drive once; subsequent insertions of the CD-ROM should then trigger the appropriate software to run automatically. RunNeeded=1; should we run the installed software? 0=no, 1=yes You may or may not wish to automatically run installed software-- you might only wish to automatically start an installer when a CD-ROM has never been used before. RunProgram16=RUN16.EXE ;Win 3.1 installed software name RunProgram32=RUN32.EXE ;Win 95 installed software name RunProgramNT=RUNNT.EXE ;Win NT installed software name These settings allow you to specify the names of the installed applications to run under the different Windows versions. The names are relative to the installed software folder, as set up in the .INI file specifed by the settings in AUTORUN.INI . If you do not need to specify different applications or documents for the different Windows versions, simply specify the same file for all three settings. You can also specify a document instead of an application to open automatically, such as a "README.TXT" file, or an HTML ".HTM" file to launch Netscape Navigator, Microsoft Internet Explorer, or whatever Web browser is installed on the user's system. For this feature to work, of course, some application must already be installed on the user's system to handle files of the specifed type. Typically, your installer will take care of verifying this, or actually installing the required software and registering it to handle files of the specifed type. RunShowAlert=1 ;show an alert before running installed software? RunAllowCancel=1 ;show cancel button on that alert? RunAlertTitle=Automatically run? ;title bar text for alert? ;Up to 5 lines of alert text RunAlertText1= RunAlertText2= RunAlertText3=Automatically run this CD's software? RunAlertText4= RunAlertText5= These settings allow you to present a minimal user interface when the CD-ROM is inserted and the software has already been installed. As noted above, user interface guidelines specify that you should notify the user when a lengthy process is being automatically started, and allow the process to be cancelled. Install16Prefix= Install32Prefix= InstallNTPrefix= Install16Suffix= Install32Suffix= InstallNTSuffix= Run16Prefix= Run32Prefix= RunNTPrefix= Run16Suffix= Run32Suffix= RunNTSuffix= These settings give you finer control over the way in which the installer and installed software are launched and run on the different Windows versions. Many Windows programs allow their operation to be modified by supplying different "command line arguments" when they are started. For instance, if you start Windows 95's Sound Recorder application (SNDREC32.EXE in the Windows folder) with the command line prefix "/play /close", followed by the name of a .WAV file, then Sound Recorder will automatically play the .WAV file and quit, rather than simply loading the ..WAV file for editing, as it would usually do. Therefore, you could make a sound file play automatically when your CD-ROM is inserted by specifying a ..WAV file as the Install or Run setting for AutoRun.EXE, and specifying the prefix setting "/play /close" . However, the version of Sound Recorder installed by WIndows 3.1 (SOUNDREC.EXE in the WIndows folder) does not support that command line syntax, so you would only want to specify such a file and prefix for Windows 95 users. When specifying a document for AutoRun.EXE to open, any prefix is prepended to the document name (with a blank space), and any suffix is appended (with a blank space); the result is supplied as a command line argument to the application registered to open that type of document. When specifing a program for AutoRun.EXE to launch rather than a document, any prefix and any suffix are joined by a blank space and provided to the program as a command line argument. Creating an AUTORUN.INF file to make AutoRun.EXE start automatically -------------------------------------------------------------------- AutoRun is a generally useful feature of the Windows 95 and Windows NT 4.0 operating systems themselves. AutoRun.EXE from Dirigo Multimedia is one application that you can choose to AutoRun when a CD-ROM is inserted. Microsoft's mechanism for specifying what to do when a CD-ROM is inserted is the AUTORUN.INF file, placed at the top level of the CD-ROM. Note the difference in file name between the .INF file used by the operating system and the private .INI file used by AutoRun.EXE itself. A minimal AUTORUN.INF file to make use of AutoRun.EXE would include... [autorun] OPEN=AUTORUN.EXE That specifies that the AUTORUN.EXE file at the top level of the CD-ROM should be run when the CD-ROM is inserted. To provide a custom icon for the CD-ROM, visible in Windows Explorer, "My Computer" windows, and file selection dialogs, you can also specify... ICON=AUTORUN.EXE,0 The "0" indicates that the first icon in the AUTORUN.EXE file should be used as the disk's icon. Windows .EXE files can contain more than one icon. You are welcome to use AutoRun.EXE's icon as your disk's icon, but you could also specify your own icon in a different .ICO or .EXE file. Beyond the scope of this Read Me document, other features are available through the AUTORUN.INF file mechanism, such as adding custom items to the context menu for a CD-ROM (the menu that pops up when you click a disk icon with the right mouse button). For more information about AUTORUN.INF, you should check Microsoft's developer documentation, and check the Microsoft Knowledge Base at http://www.microsoft.com/kb . If you are authoring a cross-platform Mac & Windows hybrid CD-ROM, make sure that the AUTORUN.INF file includes the standard Windows text file line separation characters 'return' (decimal 13), followed by 'linefeed' (decimal 10). Windows text editors such as Notepad.EXE will insert these characters for you automatically, but most Mac text editors will not. The AUTORUN.INF file will not work correctly if these characters are missing. Testing AutoRun.EXE without cutting CD-ROMs ------------------------------------------- AutoRun is typically only used on CD-ROMs, but it is possible to use the feature on other types of drives. This can be very useful to test an AutoRun.INF file without having to cut a CD-ROM. The types of drives eligible for AutoRun behavior are controlled by a setting in the Windows registry. You can use the REGEDIT.EXE program supplied with Windows 95 (installed in the Windows directory, but not given an easy-to-use program shortcut) to examine and change this setting: HKEY_CURRENT_USER Software Microsoft Windows CurrentVersion Policies Explorer "NoDriveTypeAutoRun" There are four bytes of information in this setting. Only the first byte is meaningful. The others should all be set to 0. A word of warning: the meaning of the first byte is *not* simple to interpret or change. If you wish to simply allow floppies and removable cartridges to AutoRun in addition to CD-ROMs, and you don't understand the more complete explanation of the meaning of this settings byte offered below, simply change the settings byte to the value 91. The first settings byte number is defined as the sum of the following values: DRIVE_UNKNOWN 1 DRIVE_NO_ROOT_DIR 2 DRIVE_REMOVABLE 4 (floppy disks and removable cartridges) DRIVE_FIXED 8 (hard disks) DRIVE_REMOTE 16 (network drives) DRIVE_CDROM 32 (CD-ROMs) DRIVE_RAMDISK 64 .... plus, always added to the total, the constant value 128 (provided to enable and disable new features in future Windows versions). To confuse the matter, the settings byte is specified in hexadecimal notation rather than decimal notation-- the letters A through F are used to represent the numbers 10 through 15, and the leftmost digit represents increments of 16, not 10, in the rightmost digit. A hexadecimal calculator can be very helpful when working with hex notation-- several are available in various Windows and Mac shareware repositories. AutoRun behavior is *not* allowed on drives of a particular type if the values listed above *are* included in the total value in the first settings byte. By default, when Windows 95 is installed, this settings byte is 95 in hexadecimal, which is 149 in standard decimal notation ((9 * 16) + 5). This number is the total of the individual values 128 + 16 + 4 + 1. Since the values for network drives (16), floppies and removable cartridges (4), and unknown drives (1) *are* included in the total, those types of drives will *not* AutoRun. Since the values for RAM disks (64), CD-ROMs (32), hard disks (8) and drives with no root directory (2) are *not* included in the settings byte, those types of drives *are* eligible for AutoRun behavior (assuming an AUTORUN.INF file in the proper format is in place). Therefore, if you also want to test AutoRun.INF files on floppy disks and removable cartridges, you can *remove* the value 4 from the total in the first settings byte as established by default when Windows 95 was installed. That means you'd set the first settings byte to the decimal value (149 - 4), or 145, which is specified in hexadecimal as 91 (145 / 16 for the leftmost digit, the remainder 1 for the rightmost digit). Once you have made this registry edit and restarted your computer, disks of these types should now show AutoRun behavior. However, Windows may not be able to detect the insertion of new disks for all drive types. In such cases, you can see the effects of AUTORUN.INF on the disk in question by refreshing the display of any Windows Explorer or "My Computer" window which shows your machine's disk icons (by pressing F5 or selecting View/Refresh), and, if necessary, right-clicking on the disk icon and selecting the desired AutoRun behavior from the context menu that will then appear. Limitations of AutoRun behavior ------------------------------- You should be aware that the user can disable Windows 95 and Windows NT 4.0 CD-ROM AutoRun behavior in a number of different ways. Specifically, the checkbox accessed through choosing "Start / Settings / Control Panel / System / Device Manager / CD-ROM / CD-ROM device / Settings / Auto Insert Notification" can be switched off. This checkbox is switched on by default when Windows 95 is installed on most systems. Also, not all CD-ROM drives and driver software allow the operating system to detect when a CD-ROM is inserted-- particularly 16-bit CD-ROM drivers designed for use under Windows 3.1 . Furthermore, if the user holds down the Shift key when inserting a CD-ROM, the AutoRun feature may not be used. Finally, if a user has edited the registry setting described above, a CD-ROM may not use the AutoRun feature when inserted. For this reason, you may wish to instruct your users to run AutoRun.EXE "by hand" if it does not start automatically. You will probably want to instruct your Windows 3.1 users to do this anyway. Standard legal disclaimer ------------------------- This software is provided "as is", without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. The software or its documentation or samples may include errors or technical inaccuracies. Changes are periodically made to this software, its documentation and samples, and may be incorporated in new versions. Dirigo Multimedia and g/matter, inc. may improve or change their products at any time without notice. Neither Dirigo Multimedia nor g/matter, inc. assume responsibility for, and disclaim all liability for, errors in this software or its documentation and samples. Neither Dirigo Multimedia not g/matter, inc. will be responsible for any damages of any sort under any conditions. While AutoRun.EXE contains no known bugs, use it at your own risk. As always, you should make frequent backups of important information. Some jurisdictions do not allow the exclusion of implied warranties, so the above exclusion may not apply to you.